<html>
  <head></head>
  <body>
    <div id="game"></div>
    <script type="text/javascript" src="https://rawgithub.com/craftyjs/Crafty/release/dist/crafty-min.js"></script>
    <script>
	
	  Crafty.init();
	  Crafty.e("2D, Canvas, Color, Keyboard")
	  .attr({x: 10, y: 10, w: 30, h: 30})
	  .color("red")
	  .bind('KeyDown', function(e) {
		if(e.key == Crafty.keys.LEFT_ARROW) {
		  this.x = this.x - 10;
		} else if (e.key == Crafty.keys.RIGHT_ARROW) {
		  this.x = this.x + 10;
		} else if (e.key == Crafty.keys.UP_ARROW) {
		  this.y = this.y - 10;
		} else if (e.key == Crafty.keys.DOWN_ARROW) {
		  this.y = this.y + 10;
		}
	  });
	
	  
    </script>
  </body>
</html>